home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / gptx-0_2.lha / gptx-0.2 / configure < prev    next >
Text File  |  1991-10-10  |  7KB  |  255 lines

  1. :
  2. # Guess values for system-dependant variables and create `Makefile'.
  3. # Copyright (C) 1991 Free Software Foundation, Inc.
  4.  
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9.  
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14.  
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] [TARGET]
  20. # All args except +srcdir=DIR are ignored.
  21.  
  22. trap 'rm -f conftest conftest.c; exit 1' 1 3 15
  23.  
  24. set +u # Make sure unset variables are ok.
  25.  
  26. # Make sure we don't find the System V /etc/install.
  27. PATH=`echo $PATH|sed 's,^:,|,
  28. s,:$,|,
  29. s,:/usr/etc,,g
  30. s,/usr/etc:,,g
  31. s,:/etc,,g
  32. s,/etc:,,g
  33. s,|,:,g'`
  34.  
  35. # A filename unique to this package, relative to the directory that
  36. # configure is in, which we can look for to find out if srcdir is correct.
  37. unique_file=gptx.c
  38.  
  39. for arg in $*; do
  40.   # Handle +srcdir with a space before the argument.
  41.   if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
  42.   # Handle +host with a space before the argument.
  43.   elif [ x$next_host = xyes ]; then next_host=
  44.   else 
  45.     case $arg in
  46.      -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  47.     srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
  48.      -srcdir | +srcdir | +srcdi | +srcd | +src | +sr | +s)
  49.     next_srcdir=yes ;;
  50.      -host=* | +host=* | +hos=* | +ho=* | +h=*) ;;
  51.      -host | +host | +hos | +ho | +h)
  52.     next_host=yes ;;
  53.      -gas | +gas | +ga | +g) ;;
  54.      -nfp | +nfp | +nf | +n) ;;
  55.      *) ;;
  56.     esac
  57.   fi
  58. done
  59.  
  60. # Find the source files, if location was not specified.
  61. if [ x$srcdir = x ]; then
  62.   srcdirdefaulted=yes; srcdir=.
  63.   if [ ! -r $unique_file ]; then srcdir=`pwd`/..; fi
  64. fi
  65. if [ $srcdir != . ]; then VPATH='VPATH = $(srcdir)'; fi
  66.  
  67. if [ ! -r $srcdir/$unique_file ]; then
  68.   if [ x$srcdirdefaulted = xyes ]; then
  69.     echo "$0: Can not find sources in \`.' or \`..'." 1>&2
  70.   else
  71.     echo "$0: Can not find sources in \`${srcdir}'." 1>&2
  72.   fi
  73.   exit 1
  74. fi
  75. srcdir=`cd $srcdir; pwd`
  76.  
  77. echo checking for ptx ignore file
  78. test -z "$IGNOREFILE" && test -f /usr/lib/eign && IGNOREFILE=/usr/lib/eign
  79.  
  80. if test "$RANDOM" = "$RANDOM"; then
  81.   # Plain old Bourne shell.
  82.   echo checking for gcc
  83.   test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O"
  84.  
  85.   echo checking for makeinfo
  86.   test -z "$MAKEINFO" -a -n "`makeinfo 2>&1`" && MAKEINFO=makeinfo
  87.   test -z "$MAKEINFO" -a -n "`emacs -batch -f x`" \
  88.     && MAKEINFO="emacs -batch -f batch-texinfo-format"
  89.  
  90.   echo checking for install
  91.   if test -z "$INSTALL" -a -n "`install 2>&1`"; then
  92.     INSTALL="install -c"
  93.     INSTALLDATA="install -c -m644"
  94.   fi
  95.  
  96.   echo checking for ranlib
  97.   test -z "$RANLIB" -a -n "`ranlib conftest 2>&1`" && RANLIB=ranlib
  98.   rm -f conftest
  99. else
  100.   # ksh, bash or zsh.  ksh and zsh write "command not found" to stderr.
  101.   echo checking for gcc
  102.   test -z "$CC" && type gcc && CC="gcc -O"
  103.  
  104.   echo checking for makeinfo
  105.   test -z "$MAKEINFO" && type makeinfo && MAKEINFO=makeinfo
  106.   test -z "$MAKEINFO" && type emacs \
  107.     && MAKEINFO="emacs -batch -f batch-texinfo-format"
  108.  
  109.   echo checking for install
  110.   if test -z "$INSTALL" && type install; then
  111.     INSTALL="install -c"
  112.     INSTALLDATA="install -c -m644"
  113.   fi
  114.  
  115.   echo checking for ranlib
  116.   test -z "$RANLIB" && type ranlib && RANLIB=ranlib
  117. fi
  118.  
  119. CC=${CC-cc}
  120. INSTALL=${INSTALL-cp}
  121. INSTALLDATA=${INSTALLDATA-cp}
  122. RANLIB=${RANLIB-echo}
  123.  
  124. test -n "$MAKEINFO" && INFOS=gptx.info
  125. test -n "$IGNOREFILE" && PROGS=ptx
  126.  
  127. rm -f conftest conftest.c
  128. compile='$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  129.  
  130. # Check for various header files.
  131.  
  132. echo checking for ANSI C header files
  133. echo "#ifndef __STDC__
  134. #error
  135. #endif
  136. #include <stddef.h>
  137. #include <stdlib.h>
  138. main () { exit(0); }" > conftest.c
  139. eval $compile
  140. if test -s conftest && ./conftest 2>/dev/null; then
  141.   DEFS="$DEFS -DSTDC_HEADERS"
  142. fi
  143. rm -f conftest conftest.c
  144.  
  145. # Check whether various functions exist.
  146.  
  147. # Functions whose absence we work around.
  148. for func in mcheck strerror vprintf
  149. do
  150.   echo checking for $func
  151.   echo "main() { exit(0); ${func}(); }" > conftest.c
  152.   eval $compile
  153.   if test -s conftest && ./conftest 2>/dev/null; then :
  154.   else DEFS="$DEFS -D`echo $func|tr '[a-z]' '[A-Z]'`_MISSING"
  155.   fi
  156.   rm -f conftest conftest.c
  157. done
  158.  
  159. case "$DEFS" in
  160. *VPRINTF_MISSING*)
  161.   func=_doprnt
  162.   echo checking for $func
  163.   echo "main() { exit(0); ${func}(); }" > conftest.c
  164.   eval $compile
  165.   if test -s conftest && ./conftest 2>/dev/null; then :
  166.   else DEFS="$DEFS -DDOPRNT_MISSING"
  167.   fi
  168.   rm -f conftest conftest.c
  169.   ;;
  170. esac
  171.  
  172. echo checking for BSD string and memory functions
  173. echo "#include <strings.h>
  174. main () { exit(0); rindex(0, 0); bzero(0, 0); }" > conftest.c
  175. eval $compile
  176. if test -s conftest && ./conftest 2>/dev/null; then :
  177.   else DEFS="$DEFS -DUSG"
  178. fi
  179. rm -f conftest conftest.c
  180.  
  181. echo checking for unsigned characters
  182. echo 'main() { char c = 255; exit(c < 0); }' > conftest.c
  183. eval $compile
  184. if test -s conftest && ./conftest 2>/dev/null; then
  185.   DEFS="$DEFS -DCHAR_UNSIGNED"
  186. fi
  187. rm -f conftest conftest.c
  188.  
  189. echo checking how to get alloca
  190. echo '
  191. #ifdef __GNUC__
  192. #define alloca __builtin_alloca
  193. #else
  194. #ifdef sparc
  195. #include <alloca.h>
  196. #else
  197. #ifdef _AIX
  198.  #pragma alloca
  199. #else
  200. char *alloca ();
  201. #endif
  202. #endif
  203. #endif
  204. main() { char *p = (char *) alloca(1); exit(0); }' > conftest.c
  205. eval $compile
  206. if test -s conftest && ./conftest 2>/dev/null; then :
  207. else
  208.   rm -f conftest conftest.c
  209.   echo 'char *alloca();
  210. main() { char *p = alloca(1); exit(0); }' > conftest.c
  211.   eval $compile -lPW
  212.   if test -s conftest && ./conftest 2>/dev/null; then LIBS="$LIBS -lPW"
  213.   elif test -d /usr/ucblib; then LIBS="$LIBS -L/usr/ucblib -lucb"
  214.   else ALLOCA="alloca.o"
  215.   fi
  216. fi
  217. rm -f conftest conftest.c
  218.  
  219. trap 'rm -f Makefile lib/Makefile config.status; exit 1' 1 3 15
  220.  
  221. for dir in . lib
  222. do
  223.   test -d $dir || mkdir $dir
  224.   echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
  225.   sed -e "
  226. s,@srcdir@,$srcdir,
  227. s,@VPATH@,$VPATH,
  228. s,@CC@,$CC,
  229. s,@RANLIB@,$RANLIB,
  230. s,@MAKEINFO@,$MAKEINFO,
  231. s,@INSTALL@,$INSTALL,
  232. s,@INSTALLDATA@,$INSTALLDATA,
  233. s,@IGNOREFILE@,$IGNOREFILE,
  234. s,@PROGS@,$PROGS,
  235. s,@INFOS@,$INFOS,
  236. s,@DEFS@,$DEFS,
  237. s,@LIBS@,$LIBS,
  238. s,@LIBOBJS@,$LIBOBJS,
  239. s,@ALLOCA@,$ALLOCA,
  240. " $srcdir/$dir/Makefile.in >> $dir/Makefile
  241. done
  242.  
  243. echo "CC = $CC
  244. MAKEINFO = \"$MAKEINFO\"
  245. RANLIB = $RANLIB
  246. INSTALL = $INSTALL
  247. INSTALLDATA = $INSTALLDATA
  248. IGNOREFILE = $IGNOREFILE
  249. INFOS = $INFOS
  250. PROGS = $PROGS
  251. DEFS = $DEFS
  252. LIBS = $LIBS
  253. LIBOBJS = $LIBOBJS
  254. ALLOCA = $ALLOCA" > config.status
  255.